package com.dxy.auth.provider;

import com.dxy.common.pojo.Group;
import com.dxy.common.pojo.Resource;
import com.dxy.common.pojo.Role;
import com.dxy.common.pojo.User;
import com.dxy.common.vo.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

// PS：必须要@RequestParam、@PathVariable等注解，不然会有405错误
@FeignClient(value = "user-service", path = "/user")// path可以设置服务上下文统一路径前缀
public interface UserServiceProvider {

    @GetMapping("/findUserByUserId/{userId}")
    Result<User> findUserByUserId(@PathVariable("userId") Integer userId);

    @GetMapping("/findUserByUserName/{userName}")
    Result<User> findUserByUserName(@RequestParam("userName") String userName);

    @GetMapping("/findUserGroup/{userId}")
    Result<List<Group>> findUserGroup(@PathVariable("userId") Integer userId);

    @GetMapping("/findUserRole/{userId}")
    Result<List<Role>> findUserRole(@PathVariable("userId") Integer userId);

    @GetMapping("/findUserResource/{userId}")
    Result<List<Resource>> findUserResource(@PathVariable("userId") Integer userId);

}
